<!doctype html>
<html lang="en">

	<head>
		<meta charset="UTF-8" />
		<title>Document</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../css/mui.css" />
		<link rel="stylesheet" type="text/css" href="../css/login.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">登录</h1>
		</header>
		<div class="mui-input-group">
			<div class="mui-input-row">
				<label>用户名</label>
				<input type="text" class="mui-input-clear" placeholder="请输入用户名" id="username" value="xxx">
			</div>
			<div class="mui-input-row">
				<label>密码</label>
				<input type="password" class="mui-input-clear mui-input-password" placeholder="请输入密码" id="pwd" value="123">
			</div>
		</div>
		<div class="mui-input-row" id="btn">

			<input type="button" class="mui-input-clear mui-input-password" value="登录" id="button">
		</div>
		</div>
		<div class="mui-btn-link alink">
			<a href="reg.html">注册账号</a><span>  | </span>
			<a href="">忘记密码</a>

		</div>
		<script src="../js/mui.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="../js/jquery3.2.js"></script>
		<script type="text/javascript">
			mui.init()
//			mui.plusReady(function() {
//				mui("#username").each(function() {
//					//若当前input为空，则alert提醒 
//					if(!this.value || this.value.trim() == "") {
//						var label = this.previousElementSibling;
//						mui.alert(label.innerText + "不允许为空");
//						check = false;
//						return false;
//					}
//				}); //校验通过，继续执行业务逻辑 
//				if(check) {
//					mui.alert('验证通过!')
//				}

				$('#button').on('tap',function() {
					///  alert(666666);
					var username = $('#username').val();
					var pwd = $('#pwd').val();
					console.log(pwd);
					if(username && pwd) {
						
						$.get('http://10.20.159.92:3000/login', {username:username,pwd:pwd}, function(res) {
							if(res && res.code == 0) {
								alert(88888);
								console.log(res);
								localStorage.setItem('username',username);
								localStorage.setItem('pwd',pwd);
								location.href = 'info.html';
							}

						}, 'json')
					}
				})

//			})
		</script>
	</body>

</html>